/* Endless Code Copyright (C) 2009 Jingul,Kim
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 */
package ec.gfx.ui;

import ec.Result;
import ec.core.event.MouseEvt;
import ec.gfx.GL;
import ec.gfx.Scene;
import ec.gfx.font.Font;

/**
 * @since 2009
 * @version 1.0
 * @author <a href="mailto:jingul.kim@gmail.com">Jingul,Kim</a>
 */
public class Header extends Addition {
	
	private Font font = new Font("c:\\windows\\fonts\\batang.ttc");
	
	private Text title;
	
	public Header() {
		h = 20f;
		font.setSize(4);
		
		title = new Text(font, "Subject");
	}
	
	@Override
	public Result now(Scene scene) {
		GL.color3f(1f, 0f, 0f);
		
		GL.rectf(0f, 0f, w, h);
		
		GL.pushMatrix();
		GL.translatef(3f, 5f, 0f);
		title.now(scene);
		GL.popMatrix();
		
		return Result.OK;
	}
	

	@Override
	public void processMouseEvt(MouseEvt e) {
//		super.processMouseEvt(e);
		
		switch(e.getType()) {
		case MouseEvt.UP:
			break;
		default:
		}
	}
	
	@Override
	public void addNotify() {
		w = parent.getWidth();
	}
	
	@Override
	protected void notifyResized() {
		w = parent.getWidth();
	}
	
	public void setText(String text) {
		title.setChars(text);
	}
}
